package com.study.talk.data.local;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.study.talk.data.model.GroupInfo;

import java.util.List;

/**
 * @author thor
 * @description: TODO
 * @date 2024/12/31 10:58
 */
@Dao
public interface GroupInfoDao {
    @Insert
    void insert(GroupInfo groupInfo);

    @Insert
    void insert(List<GroupInfo> groupInfos);

    @Delete
    void remove(GroupInfo groupInfo);

    @Delete
    void remove(List<GroupInfo> groupInfos);

    @Update
    void update(GroupInfo groupInfo);

    @Update
    void update(List<GroupInfo> groupInfos);

    @Query("SELECT * FROM group_info")
    List<GroupInfo> query();

    @Query("SELECT * FROM group_info WHERE id=(:id)")
    GroupInfo query(Integer id);

    @Query("SELECT COUNT(*) FROM group_info WHERE id=(:id)")
    Boolean has(Integer id);
}
